/**
 * @author
 */
(function() {
	var autoloadJsFilePath = [
	 'waf/js/angular/angular.js',
	 'waf/js/angular/angular-animate.js',
	 'waf/js/angular/angular-local-storage.js',
	 'waf/js/angular/angular-logger.js',
	 'waf/js/angular/angular-ui-router.js',
	 'waf/js/angular/angular-translate.js',
	 'waf/js/angular/angular-resource.js',
	 'waf/js/angular/angular-clipboard.js',
	 'waf/js/module/chart/Chart.js',
	 'waf/js/module/chart/angular-chart.js',
	 'waf/js/module/oclazyload/ocLazyLoad.js',
	 'waf/js/module/bootstrap/ui-bootstrap-tpls.js',
	 'waf/js/module/bootstrap/bootstrap-colorpicker-module.js',
	 'waf/js/module/uigrid/ui-grid.js',
	 'waf/js/module/hotkeys/mousetrap.js',
	 'waf/js/module/hotkeys/hotkeys.js',
	 'waf/js/module/file/FileSaver.js',
	 'waf/js/module/file/angular-file-upload.js',
	 'waf/js/module/contextmenu/context-menu.js',
	 'waf/js/module/pti/fs-logger.js',
	 'waf/js/module/pti/fs-storage.js',
	 'waf/js/module/pti/fs-router.js',
	 'waf/js/module/pti/fs-validator.js',
	 'waf/js/module/pti/fs-layout.js',
	 'waf/js/module/pti/fs-menu.js',
	 'waf/js/module/pti/fs-modal.js',
	 'waf/js/waf.js',
	 'waf/js/wafConfig.js',
	 'waf/js/wafMain.js',
	 'waf/js/common/service/httpInterceptor.js',
	 'waf/js/common/service/i18nLoader.js',
	 'waf/js/common/service/ajaxServiceFactory.js',
	 'waf/js/common/service/signonService.js',
	 'waf/js/common/service/gridService.js',
	 'waf/js/common/service/formatService.js',
	 'waf/js/common/service/arithService.js',
	 'waf/js/common/service/big.js',
	 'waf/js/common/service/dateService.js',
	 'waf/js/common/service/keyDownService.js',
	 'waf/js/common/service/commonService.js',
	 'waf/js/common/filter/fs-filter.js',
	 'waf/js/common/directive/formater.js',
	 'waf/js/common/directive/authorization.js',
	 'waf/js/common/router/routerConfig.js',
	 'waf/js/common/router/pageRouter.js',
	 'waf/js/common/router/lookupRouter.js',
	 'waf/js/common/router/popupRouter.js'
	];
	var autoloadCssFilePath = [
 	 'waf/css/waf.css',
 	 'waf/css/DEFAULT/app.css',
 	 'waf/css/animate.css',
 	 'waf/css/colorpicker.css',
 	 'waf/js/module/hotkeys/hotkeys.css',
 	 'waf/js/module/uigrid/ui-grid.css'
 	];
	
	for (var i = 0; i < autoloadCssFilePath.length; i++) {
		addTag('link', {
			"rel" : "stylesheet",
			"href" : autoloadCssFilePath[i]
		});
	}

	for (var i = 0; i < autoloadJsFilePath.length; i++) {
		addTag('script', {
			"type" : "text/javascript",
			"src" : autoloadJsFilePath[i]
		});
	}

	function addTag(name, attributes) {
		var el = document.createElement(name), attrName;

		for (attrName in attributes) {
			el.setAttribute(attrName, attributes[attrName]);
		}
		document.write(outerHTML(el));
		document.close();
	}

	function outerHTML(node) {
		// if IE, Chrome take the internal method otherwise build one
		return node.outerHTML || (function(n) {
			var div = document.createElement('div'), h;
			div.appendChild(n);
			h = div.innerHTML;
			div = null;
			return h;
		})(node);
	}

	window.addTag = addTag;

})();
